package pbbltobpel.model.steps;

import java.util.ArrayList;
import java.util.List;

import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class AssignStep extends Step {
	private boolean validate;
	private List<Copy> copies;

	public AssignStep(){
		setCopies(new ArrayList<Copy>());
	}
	
	public boolean isValidate() {
		return validate;
	}

	public void setValidate(boolean validate) {
		this.validate = validate;
	}

	public List<Copy> getCopies() {
		return copies;
	}

	public void setCopies(List<Copy> copies) {
		this.copies = copies;
	}
	
	@Override
	public Element getXmlElement(Document doc) {
		Element element = doc.createElement("bpel:assign");
		element.setAttribute("name", getName());
		element.setAttribute("validate", validate ? "yes" : "no");
		for(Copy copy : copies)
			element.appendChild(copy.getXmlElement(doc));
		return element;
	}
}
